<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>B612信息公开监督管理平台</title>

    <!-- ================= Favicon ================== -->
    <!-- Styles -->

    <link rel="stylesheet" href="./frame/assets/css/lib/bootstrap.min.css">
    <link rel="stylesheet" href="./frame/assets/css/lib/font-awesome.min.css">
    <link rel="stylesheet" href="./frame/assets/css/lib/themify-icons.css">
    <link rel="stylesheet" href="./frame/assets/css/lib/unix.css">
    <link rel="stylesheet" href="./frame/assets/css/style.css">
    <link rel="stylesheet" href="./frame/assets/css/input.css">
</head>

<body class="bg-primary">
<div class="unix-login">
    <div class="container">
        <div class="row">
            <div class="col-lg-6 col-lg-offset-3">
                <div class="login-content">
                    <div class="login-form">
                        <h3 style="color: #5d7d8c;">Regist Account</h3>
                        <form>
                            <div class="form-group">
                                <label style="font-family: Georgia;color: #5d7d8c;">用户名</label>
                                <input type="text" id="regist_name" class="form-control" placeholder="请输入用户名（3-20个字符）">
                            </div>
                            <div class="form-group">
                                <label style="font-family: Georgia;color: #5d7d8c;">密码</label>
                                <input type="password" id="regist_password" class="form-control" placeholder="密码（8-20个字符）">
                            </div>
                            <div class="form-group">
                                <label style="font-family: Georgia;color: #5d7d8c;">确认密码</label>
                                <input type="password" id="regist_password2" class="form-control" placeholder="再次输入密码">
                            </div>
                            <div class="error_box" id="error_regist"></div>
                            <button type="button" class="btn btn-primary btn-rounded m-b-30 m-t-30" id="regist"><span>注      册</span></button>
                            <div class="register-link m-t-15 text-center" >
                                <p>已有账号? <a href="login.html">登录</a></p>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="./frame/assets/js/lib/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="./frame/layui/lay/modules/layer.js"></script>
<link rel="stylesheet" href="./frame/layui/lay/modules/layer/default/layer.css">
<link rel="stylesheet" href="./frame/layui/css/layui.css"  media="all">
<script type="text/javascript" src="./frame/layui/layui.js" charset="utf-8"></script>
<script>
    $("#regist").click(function (){
       var name= $("#regist_name").val();
        var pwd1= $("#regist_password").val();
        var pwd2= $("#regist_password2").val();
        if(pwd1!=pwd2){
            alert("两次输入的密码不一致,请重新输入");
            return;
        }
        $.ajax({
            type:"get",//post或者get，非必须
            url:"/addadmin",//必须的
            dataType:"json",//text/xml/json，非必须
            data:{"name":name,"pwd":pwd1},
            success:function(data){//回调函数，非必须
                if(data.code=='1'){
                    window.location.href="login.html";
                }
                else {
                    alert("注册失败")
                }
            }
        });
    });

</script>
</html>
